/*Name:Yifu Diao
 *Dec 8,2010
 *15600-HW9 
 * */
package edu.cmu.cs.task7.model;

import com.ebay.sdk.ApiContext;
import com.ebay.sdk.ApiException;
import com.ebay.sdk.SdkException;
import com.ebay.sdk.call.GetItemCall;
import com.ebay.soap.eBLBaseComponents.DetailLevelCodeType;
import com.ebay.soap.eBLBaseComponents.ItemType;

public class GetItemModel {
	 private String itemid;
	 private ApiContext apiContext=new ApiContext();	 
	 
     public GetItemModel(ApiContext apiContext, String itemid)  throws Exception{
    	 this.apiContext=apiContext;
    	 this.itemid=itemid; 
     }
     
     public ItemType getItem() throws ApiException, SdkException, Exception{
    	 GetItemCall api = new GetItemCall(apiContext);
         
    	 //See  DetailLevelCodeType page for more information
    	 //http://developer.ebay.com/devzone/xml/docs/reference/ebay/types/DetailLevelCodeType.html
         DetailLevelCodeType[] detailLevels = new DetailLevelCodeType[] {
             //DetailLevelCodeType.RETURN_ALL,  //returns all data, which is excessive
             DetailLevelCodeType.ITEM_RETURN_ATTRIBUTES,  // (in) For GetItem, returns Item Specifics and Pre-filled Item Information, if any.
             DetailLevelCodeType.ITEM_RETURN_DESCRIPTION,  //(in) Returns Description, plus the ListingDesigner node and some additional information if applicable

         };
         api.setDetailLevel(detailLevels);
         ItemType item = api.getItem(itemid);
         return item;
    	 
     }
     
}
